home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group99a.txt
/
000190_icon-group-sender _Wed Sep 8 07:49:48 1999.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
3KB
Return-Path: <icon-group-sender>
Received: (from root@localhost)
by baskerville.CS.Arizona.EDU (8.9.1a/8.9.1) id HAA28346
for icon-group-addresses; Wed, 8 Sep 1999 07:49:39 -0700 (MST)
Message-Id: <199909081449.HAA28346@baskerville.CS.Arizona.EDU>
From: "Frank Lhota" <lhotaf@lexma.meitech.com>
To: "Richard A. O'Keefe" <ok@hermes.otago.ac.nz>,
<icon-group@optima.CS.Arizona.EDU>, <memphis@macconnect.com>
Subject: Re: Is open(..,"b") broken in MPW Icon 9.0?
Date: Wed, 8 Sep 1999 09:38:42 -0400
X-Priority: 3
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Errors-To: icon-group-errors@optima.CS.Arizona.EDU
Status: RO
Armed with this information, I would try this in the [@fsys.05] section for
MACINTOSH:
#if MACINTOSH
if ((status & (Fs_Read|Fs_Write)) == (Fs_Read|Fs_Write)) {
mode[1] = '+';
if ((status & Fs_Untrans) != 0) mode[2] = 'b';
}
else if ((status & Fs_Untrans) != 0) mode[1] = 'b';
#endif /* MACINTOSH */
Please let me know if this fixes the problem.
While we're on the subject, it might be worth our while to revisit the
[@fsys.05] section of code. Quite conceivably, we could cut this section out
entirely The raison d'jtre for this section is that in Vanilla C, the form
of the fopen mode parameter was platform specific. The only mode parameters
spelled out in the original K&R book were "r", "w", and "a", although many
pre-ANSI compilers supported more options.
With ANSI C, the form of the fopen mode has become much better standardized.
The ANSI standard actually requires support for the '+' and 'b' fopen modes,
so the code given above for the MACINTOSH could be used for all platforms.
Once this is done, the only platform specific tweaking would be if you
wanted to include a 't' for translated modes, e.g.
#if MSDOS || ( OS2 && !CSET2 )
if ((status & Fs_Untrans) == 0) strcat(mode,"t");
endif /* MSDOS || ( OS2 && !CSET2 ) */
Even this is not absolutely necessary, since fopen defaults to opening in
text mode if the mode parameter does not include 'b'. Since Icon now
requires an ANSI compiler, we could simply retire the [@fsys.05] section and
replace it with the code for adding 'b' and '+' to mode.
----- Original Message -----
From: Richard A. O'Keefe <ok@hermes.otago.ac.nz>
To: <icon-group@optima.CS.Arizona.EDU>; Lhota, Frank
<lhotaf@lexma.meitech.com>; <memphis@macconnect.com>
Sent: Tuesday, September 07, 1999 9:13 PM
Subject: Re: Is open(..,"b") broken in MPW Icon 9.0?
> #if MACINTOSH
> if ((status & (Fs_Read|Fs_Write)) == (Fs_Read|Fs_Write)) {
> mode[1] = '+';
> mode[2] = ((status & Fs_Untrans) != 0) ? 'b' : 't';
> }
> else mode[1] = ((status & Fs_Untrans) != 0) ? 'b' : 't';
> #endif /* MACINTOSH */
>
> 't' is a Windows-ism that has no defined effect in the C standard,
> nor is it defined in any of the Macintosh C compilers I have ready
> access to. The modes supported are
>
> (r|w|a)(+[b]|b[+])
>
> Some Macintosh C compilers define '\n' to be CR, which is the only
> really sensible choice, and with those compilers the 'b' option is
> superfluous. Some define '\n' to be LF, which is really really
> silly, and those compilers translate between external CR and internal
> LF. So the 'b' option is not superfluous with those compilers.